package com.fei.jvmtest;

public class ReferenceGC {
    public Object instance = null;
    
    private static final int _1MB = 1024 * 1024;
    
    
    private byte[] b = new byte[2 * _1MB];
    
    public static void testGC(){
        ReferenceGC a = new ReferenceGC();
        ReferenceGC b = new ReferenceGC();
        
        a.instance = b;
        b.instance = a;
        
        a = null;
        b = null;
        
        System.gc();
    }
    
    public static void main(String[] args) {
        testGC();
    }
    
    @Override
    protected void finalize() throws Throwable {
        super.finalize();
        System.out.println("ssssssss" + instance);
    }
}
